package com.wordLearning.word.infra.basic.service.impl;

import com.wordLearning.word.infra.basic.dao.UnmasteredWordDao;
import com.wordLearning.word.infra.basic.entity.UnmasteredWord;
import com.wordLearning.word.infra.basic.service.UnmasteredWordService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (UnmasteredWord)表服务实现类
 *
 * @author makejava
 * @since 2025-03-22 20:19:54
 */
@Service("unmasteredWordService")
public class UnmasteredWordServiceImpl implements UnmasteredWordService {
    @Resource
    private UnmasteredWordDao unmasteredWordDao;

    /**
     * 通过ID查询单条数据
     *
     * @param recordId 主键
     * @return 实例对象
     */
    @Override
    public UnmasteredWord queryById(Integer recordId) {
        return this.unmasteredWordDao.queryById(recordId);
    }

    /**
     * 新增数据
     *
     * @param unmasteredWord 实例对象
     * @return 实例对象
     */
    @Override
    public UnmasteredWord insert(UnmasteredWord unmasteredWord) {
        this.unmasteredWordDao.insert(unmasteredWord);
        return unmasteredWord;
    }

    /**
     * 修改数据
     *
     * @param unmasteredWord 实例对象
     * @return 实例对象
     */
    @Override
    public UnmasteredWord update(UnmasteredWord unmasteredWord) {
        this.unmasteredWordDao.update(unmasteredWord);
        return this.queryById(unmasteredWord.getRecordId());
    }

    /**
     * 通过主键删除数据
     *
     * @param recordId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer recordId) {
        return this.unmasteredWordDao.deleteById(recordId) > 0;
    }

    @Override
    public int deleteByCondition(Integer wordId) {
        return this.unmasteredWordDao.deleteByCondition(wordId);
    }

    @Override
    public int countByCondition(UnmasteredWord unmasteredWord) {
        return this.unmasteredWordDao.countByCondition(unmasteredWord);
    }

    @Override
    public List<UnmasteredWord> queryPage(UnmasteredWord unmasteredWord, int start, Integer pageSize) {
        return this.unmasteredWordDao.queryPage(unmasteredWord,start,pageSize);
    }
}
